{% extends 'layout.html' %}

{# Set variables for base layour #}
{% set active_page = 'submit' %}
{% set title = 'Submit' %}

{% block content %}
    
    {% if flash %}
        <div class="alert bg-red">
            {{ flash }}
        </div>
    {% endif %}
    
    {# "shortcut-submit" is a class used exclusively from javascript
    # to submit the form when a key (Ctrl+Enter) is pressed.
    #}
    <form action="" method="post" class="submit shortcut-submit">
        <h3>Title</h3>
        <div>
            <input type="text" name="title" class="form-control" required='required' autofocus />
        </div>

        <h3>Link</h3>
        <div>
            <input type="text" name="link" class="form-control" />
        </div>
        
        {% if settings ('defaults', 'topics_per_post') > 0 %}
            <h3>Topics</h3>
            <div>
                <input type="text" name="topics" value="{{ request.query.topic }}" class="form-control" />
            </div>
            <div>
                Max {{ settings ('defaults', 'topics_per_post') }}
                (eg. FreeSoftware OpenData ...)
            </div>
        {% endif %}

        <h3>Text</h3>
        <div>
            <textarea name="text" rows=10 class="form-control"></textarea>
        </div>

        <div style="margin: 1em 0 0 0;">
            <input type="submit" class="button button_info" value="Submit post" />
        </div>
    </form>

{% endblock %}
